package com.bawei.mvvm.utills

import android.content.Context
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.CenterCrop
import com.bumptech.glide.load.resource.bitmap.CircleCrop
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import java.net.URL

object GlideUtils {
    /**
     * 普通图片
     */
    fun loadNormal(context:Context,imageView: ImageView,url: String){
        Glide.with(context)
            .load(url)
            .skipMemoryCache(true)//关闭内存缓存
            .transform(CenterCrop())
            .into(imageView)
    }
    /**
     * 圆形图片
     */
    fun loadCircle(context:Context,imageView: ImageView,url: String){
        Glide.with(context)
            .load(url)
            .skipMemoryCache(true)//关闭内存缓存
            .transform(CircleCrop())
            .into(imageView)
    }

    /**
     * 圆形图片
     */
    fun loadRounded(context:Context,imageView: ImageView,url: String,roundingRadius:Int){
        Glide.with(context)
            .load(url)
            .skipMemoryCache(true)//关闭内存缓存
            .transform(CenterCrop(),RoundedCorners(roundingRadius))
            .into(imageView)
    }






}